package com.example.jpa1.service;


import com.example.jpa1.dao.DeskDao;
import com.example.jpa1.pojo.Desk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DeskService {

    @Autowired
    private DeskDao deskDao;


    public Desk save(Desk desk){
        Desk save = deskDao.save(desk);
        return save;
    }

    public List<Desk> list(){
        List<Desk> list = deskDao.list();
        return list;
    }
    public Desk edit(Desk desk){
        return deskDao.edit(desk);

    }

    public void deleteById(Long id){
        deskDao.deleteById(id);
    }
}
